//TriPrism.cpp
//Contains the function definitions for the Triangular Prism Class

#include <iostream>
#include "TriPrism.h"

using namespace std;

TriPrism::TriPrism(const float &p_X, const float &p_Y, float s_A, float s_B, float s_C, float hgt)
	: Triangle(p_X, p_Y, s_A, s_B, s_C)
{
	setHeight(hgt);
	setVol();
	setPerimeter(0,0,0);
	setShapeType("Triangular Prism");
}

void TriPrism::setHeight(float hgt)
{
	if (hgt > 0.0)
		height = hgt;
	else
		throw invalid_argument("The height must be greater than zero.");
}

float TriPrism::getHeight() const
{
	return height;
}

void TriPrism::setVol()
{
	TP_volume = (getHeight() * Triangle::area()) / 3;
}

float TriPrism::getTpVol() const
{
	return TP_volume;
}

float TriPrism::volume() const
{
	return getTpVol();
}

float TriPrism::area() const
{
	return Triangle::getArea();
}

float TriPrism::perimeter() const
{
	return Triangle::getPerimeter();
}

